<!DOCTYPE html>
<html manifest="./offline.appcache">
	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">		
		
	</head>
	<body>
		<input id="content" type="text" />
		<h1>更新2次</h1>
	</body>
	<script type="text/javascript">
		var content = document.getElementById('content')
		content.addEventListener('blur',function(){
			var data = content.value;
			if(navigator.onLine){
				saveOnline(data)
			}else{
				localStorage.setItem('data',data)
			}
			
		})
		
		function saveOnline(data){
			alert('data='+data)
		}
		
		
		if(navigator.onLine){
			var data = localStorage.getItem('data')
			if(data){
				alert("缓存")
				saveOnline(data)
				localStorage.removeItem('data')
			}
		}else{
			alert("2")
		}
		
	</script>
</html>
